<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>当当购物车</title>
    <link rel="stylesheet" href="./css/cart.css">
</head>

<body>
    <div class="container">
        <div class="header">
            <img src="./image/dd_logo.jpg" alt="logo">
            <button id="product-list">商品列表</button>
        </div>
        <div class="book-list">
            <table>
                <!-- 购物车节点： 遍历购物车数据，生成购物车节点，作为内容添加给tabel -->
            </table>
            <h2>商品总价: <span id="totalPrice">￥0</span></h2>
        </div>

    </div>

    <script src="js/template-web.js"></script>
    <script type="text/html" id="show">
        <tr>
            <td><input type="checkbox" class="checkbox-all" {{checkedAllState ? 'checked' : ''}} ></td>
            <td>序号</td>
            <th>商品图片</th>
            <th>商品信息</th>
            <th>单价</th>
            <th>数量</th>
            <th>总价</th>
            <th>操作</th>
        </tr>
        {{each carts}}
        <tr>
            <td><input type="checkbox" class="checkbox-item" {{$value.state ? 'checked' : ''}}  data-index="{{$index}}"></td>
            <td>{{$value.id}}</td>
            <td><img src="{{$value.picture}}" alt="shop03" width="50" height=""></td>
            <td>{{$value.product}}</td>
            <td>￥{{$value.price}}</td>
            <td><input type="button" name="minus" value="-" {{$value.num==0 ? 'disabled' : ''}}  data-index="{{$index}}">
                <input type="text" name="amount" value="{{$value.num}}" data-index="{{$index}}"><input type="button"
                    name="plus" value="+" data-index="{{$index}}"></td>
            <td class="singleprice" width="100px">￥{{$value.singlePrice}}</td>
            <td><a href="#">移入收藏</a><br><a class="deleteBtn" href="#" data-index="{{$index}}">删除</a></td>
        </tr>
        {{/each}}
    </script>
    <script src="./js/cart.js"></script>
</body>

</html>